import jsonschema
# 定义待校验数据
resp={"success":True,
 "code": 10000,
 "message": "操作成功"}
# 定义规则-预期规则
sachema={
 "type": "object",
 "properties": {
 "success": {
 "type": "boolean"
 },
 "code": {
 "type": "integer"
 },
 "message": {
 "type": "string"
 }
 },
 "required": ["success", "code", "message"]
}
# 校验规则是否相符
res=jsonschema.validate(instance=resp,schema=sachema)
print(res)